package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.FixedDeteDetail;
import com.indusfo.spc.service.FixedDeteDetailService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author louk
 * @description 固定检测项目明细
 * @date 2019/11/23 18:11
 */
@Controller
@RequestMapping("/service/fixedDeteDetail")
public class FixedDeteDetailController {

    @Resource
    private FixedDeteDetailService fixedDeteDetailService;

    /**
     * 新增明细
     * @param fixedDeteId
     * @param deteValue
     * @return
     */
    @RequestMapping("/insertDetail")
    @ResponseBody
    JSONObject insertDetail(String[] deteValue,Integer fixedDeteId,String[] deteDate){
        return fixedDeteDetailService.insertDetail(deteValue,fixedDeteId,deteDate);
    }

    /**
     * 新增明细传递集合
     * @param fixedDeteDetailList
     * @return
     */
    @RequestMapping("/insertDetailList")
    @ResponseBody
    JSONObject insertDetailList(@RequestBody ArrayList<FixedDeteDetail> fixedDeteDetailList){
        return fixedDeteDetailService.insertDetailList(fixedDeteDetailList);
    }

    /**
     * 查询明细
     * @param fixedDeteDetail
     * @return
     */
    @RequestMapping("/queryAllDetailList")
    @ResponseBody
    JSONObject queryAllDetailList(FixedDeteDetail fixedDeteDetail){
        return fixedDeteDetailService.queryAllDetailList(fixedDeteDetail);
    }

    /**
     * 更新
     * @param fixedDeteDetail
     * @return
     */
    @RequestMapping("/updateDetail")
    @ResponseBody
    JSONObject updateDetail(FixedDeteDetail fixedDeteDetail){
        return fixedDeteDetailService.updateDetail(fixedDeteDetail);
    }

    /**
     * 启用停用
     * @param fixedDeteDetailIds
     * @param dataState
     * @return
     */
    @RequestMapping("/definesDetailList")
    @ResponseBody
    JSONObject definesDetailList(Integer[] fixedDeteDetailIds,Integer dataState){
        return fixedDeteDetailService.definesDetailList(fixedDeteDetailIds,dataState);
    }
}
